<template>
  <div class="travel">   
    <travel-recommend :list="recommendList"></travel-recommend>
  </div>
</template>

<script>
// "./"代表本目录，"../"代表上一次目录
import  TravelRecommend from './components/TravelRecommend.vue' 
import axios from 'axios'

export default {
  name: 'travel',
  components: {
    TravelRecommend
  },
  data: function(){
    return{
       iconList: [],
      recommendList: []
    }
  },
  mounted(){
    this.getTravelApiInfo()
  },
  methods: {
    getTravelApiInfo(){
      axios.get("/mock/travel.json").then(this.getTravelResponseInfo)
    },
    getTravelResponseInfo(response){
      //  console.log(response.data);
      let res = response.data  //就是home.json里面的内容
      if(res.success && res.dataList){
        const data = res.dataList //取json中的datalist属性
        // console.log(data.iconLists.length)
        this.iconList = data.iconLists
        this.recommendList = data.recommendLists
      }
    }
  }
}
</script>
